package pro.shushi.pamirs.hr.core.action.eam;

import org.springframework.stereotype.Component;
import pro.shushi.pamirs.hr.api.model.eam.common.AbstractCopyModel;
import pro.shushi.pamirs.hr.api.model.eam.common.AbstractOrgBaseModel;
import pro.shushi.pamirs.hr.core.session.HrSimpleSession;
import pro.shushi.pamirs.meta.annotation.Function;
import pro.shushi.pamirs.meta.annotation.Model;
import pro.shushi.pamirs.meta.annotation.fun.extern.Slf4j;
import pro.shushi.pamirs.meta.enmu.FunctionOpenEnum;
import pro.shushi.pamirs.meta.enmu.FunctionTypeEnum;
import pro.shushi.pamirs.user.api.model.PamirsUser;

/**
 * @description:
 * @author: jin
 */
@Slf4j
@Component
@Model.model(AbstractOrgBaseModel.MODEL_MODEL)
public class AbstractOrgBaseModelAction {

    @Function(openLevel = FunctionOpenEnum.API)
    @Function.Advanced(type = FunctionTypeEnum.QUERY)
    public AbstractOrgBaseModel construct(AbstractOrgBaseModel data) {
        PamirsUser user = HrSimpleSession.getUser();
        //用户没组织编码，暂时写死组织编码
        if(user != null) {
            data.setOrgCode("001");
        }
        data.construct();
        return data;
    }

}
